<include file="Index:header" />
<!-- Content Header (Page header) -->
    <section class="content-header">
      <h1> 更新友情链接 </h1>
      <ol class="breadcrumb">
        <li><a href="__APP__/TIFAWEB_DSWJCMS.html" class="goindex"><i class="fa fa-dashboard"></i> 首页</a></li>
        <li> 基础配置</li>
        <li><a href="__APP__/TIFAWEB_DSWJCMS/Basis/links.html"> 友情链接</a></li>
        <li class="active">更新友情链接</li>
      </ol>
    </section>
<!--主体-->
    <!-- Main content -->
  <section class="content">
  <form method="post"  action='__APP__/TIFAWEB_DSWJCMS/Basis/editli' enctype="multipart/form-data">
    <div class="box">
    <div class="box-body">
    <table class="table table-bordered">
     <volist name="edlist" id="ed">
     <input name="id" type="hidden" value="{$ed.id}" />
       <tbody>
		  <tr>
            <td>
                   标题：
            </td>
            <td>
              <input name="title" type="text" class="form-control" placeholder="请输入标题..." value="{$ed.title}">
            </td>
          </tr>
          <tr>
            <td>
                   URL：
            </td>
            <td>
              <input name="url" type="text" class="form-control" placeholder="请输入url..." value="{$ed.url}">
            </td>
          </tr>
          <tr>
            <td>
                   图片：
            </td>
            <td>
              <div class="imgupload"  id="fileList"  style="width:202px;height:102px;">
                <input name="img" type="hidden" value="{$ed.img}" />
                <img src="__PUBLIC__/uploadify/uploads/undefined/{$ed.img}" style="width:200px;height:100px;"/>
                </div>
                <input name="input" type="file" id="fileElem" multiple accept="image/*"  onchange="handleFiles(this)" class="hide">
            </td>
          </tr>
          <tr>
            <td>
                   状态：
            </td>

            <td class="form-group">
                <if condition="$ed.state eq 0">
                   <label><input type="radio" name="state" class="minimal" value="0" checked/> 显示</label>
                  <label><input type="radio" name="state" class="minimal" value="1" /> 隐藏</label>
                   <else />
                   <label><input type="radio" name="state" class="minimal" value="0" /> 显示</label>
                  <label><input type="radio" name="state" class="minimal" value="1" checked/> 隐藏</label>
                   </if>
            </td>
          </tr>
           <tr>
            <td>
                   排序：
            </td>
            <td>
              <input name="order" type="text" class="form-control" value="{$ed.order}">
            </td>
          </tr>
        </tbody>
     </volist>
     </table>
    </div>
    </div>
    <div class="row">
     <button class="btn btn-primary pull-right" style="margin-right: 15px;"  type="submit">
                  确认修改
              </button>
    </div>
    </form>
    
  </section>
<include file="Index:footer" />
<script>
//图片上传处理
window.URL = window.URL || window.webkitURL;
    var fileElem = document.getElementById("fileElem"),
    fileList = document.getElementById("fileList");
	fileList.addEventListener('click',function(){
		fileElem.click();
	},false);
    function handleFiles(obj) {
        var files = obj.files,
        img = new Image();
        if(window.URL){
            //File API
            //alert(files[0].name + "," + files[0].size + " bytes");
            img.src = window.URL.createObjectURL(files[0]); //创建一个object URL，并不是你的本地路径
            img.onload = function(e) {
                window.URL.revokeObjectURL(this.src); //图片加载后，释放object URL
            }
			
            fileList.innerHTML='<img src="'+img.src+'" style="width:200px;height:100px;"/>';
        }else if(window.FileReader){
            //opera不支持createObjectURL/revokeObjectURL方法。我们用FileReader对象来处理
            var reader = new FileReader();
            reader.readAsDataURL(files[0]);
            reader.onload = function(e){
               // alert(files[0].name + "," +e.total + " bytes");
                img.src = this.result;
                img.width = 200;
                 fileList.innerHTML='<img src="'+img.src+'"  style="width:200px;height:100px;"/>';
            }
        }else{
            //ie
            obj.select();
            obj.blur();
            var nfile = document.selection.createRange().text;
            document.selection.empty();
            img.src = nfile;
            img.width = 200;
            img.onload=function(){
                //alert(nfile+","+img.fileSize + " bytes");
            }
            fileList.innerHTML='<img src="'+img.src+'"  style="width:200px;height:100px;"/>';
        }
    }
	
</script>